<template>
  <header>
    <div>
      <i class="el-icon-s-fold"></i>
      <i class="el-icon-s-unfold" v-show="false"></i>
    </div>
    <div class="opt-wrapper">
      <el-dropdown :hide-on-click="false">
        <span class="el-dropdown-link"> <img :src="avatar" alt="" class="avatar"/></span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item @click.native="leave"><i class="el-icon-switch-button"></i>退出登录</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </header>
</template>

<script>
export default {
  data() {
    return {
      avatar: require('../assets/cat.jpg')
    }
  },
  methods:{
    leave(){
      alert("已退出!");
      this.$router.push('/')
    }
  }
}
</script>

<style >
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  /* .el-icon-s-fold,
  .el-icon-s-unfold {
    font-size: 25px;
    cursor: pointer;
  } */
}

.avatar {
  margin-top: 10px;
  margin-right: 40px;
  height: 40px;
  width: 40px;
  border-radius: 50%;
  cursor: pointer;
}
</style>